import { request } from "@/utils";

// 1.文章发布中频道数据获取
export function channelAPI() {
    return request({
        url: '/channels',
        method: 'GET'
    })
}

// 2.收集表单数据
export function getFormAPI(data) {
    return request({
        url: '/mp/articles?draft=false',
        method: 'POST',
        data: data
    })
}

// 编辑文档
export function updateArticle(data) {
    return request({
        url: `/mp/articles/${data.id}?draft=false`,
        method: 'PUT',
        data: data
    })
}

// 3.获取文章列表数据
export function ArticleDataAPI(params) {
    return request({
        url: '/mp/articles',
        method: 'GET',
        params

    })
}

// 4.删除指定文章
export function delArticleAPI(id) {
    return request({
        url: `/mp/articles/${id}`,
        method: 'DELETE'
    })
}

//5.根据id获取文章详情
export function getArticleById(id) {
    return request({
        url: `/mp/articles/${id}`
    })
}